package ru.study.thinkin.chapter14;

import java.util.*;

public class GenericVarargs {
	public static <T> List<T> makeList(T...args) {
		List<T> list = new ArrayList<T>();
		for (T item : args) {
			list.add(item);
		}
		return list;		
	}
	
	public static void main(String[] args) {
		List<String> ls = GenericVarargs.makeList("A");
		System.out.println(ls);
		ls =  GenericVarargs.makeList("A","B");
		System.out.println(ls);
		
		List<Integer> li = GenericVarargs.makeList(1);
		System.out.println(li);
		List<List<Integer>> li2 = GenericVarargs.makeList(Arrays.asList(new Integer[]{1,2,3}));
		System.out.println(li2);

	}

}
